10 CLS
20 KEY OFF
30 PRINT "NET PRESENT VALUE"
40 DEFDBL A-Z:DEFINT J,N
50 DEF FNA(X)=INT(X*100+.5)/100
60 PRINT
70 PRINT "INVESTMENT ";
80 INPUT C0
90 C0=-FNA(C0)
100 PRINT "NUMBER OF YEARS ";
110 INPUT N
120 DIM C(N)
130 PRINT "REQUIRED RATE OF RETURN (%) ";
140 INPUT R
150 R=R/100+1
160 F=0
170 PRINT
180 PRINT "ENTER CASH FLOW AMOUNTS EACH YEAR ";
190 PRINT "(ENTER OUTFLOWS AS NEGATIVE)."
200 PRINT
210 FOR J=1 TO N
220 IF J>1 THEN 250
230 PRINT "INFLOW FOR YEAR";
240 GOTO 260
250 PRINT "               ";
260 PRINT J;
270 INPUT C(J)
280 F=F+FNA(C(J))
290 NEXT J
300 T=C0
310 REM  ADD PRESENT VALUES FOR EACH YEAR BASED ON RATE OF R
320 FOR J=1 TO N
330 T=T+FNA(C(J)/R^J)
340 NEXT J
350 PRINT
360 PRINT "NET PRESENT VALUE =";
370 PRINT USING "$$,###,###,###.##"; T
380 REM  RESTART OF END PROGRAM?
390 PRINT
400 PRINT "DO YOU WANT TO RE-RUN THIS PROGRAM";
410 PRINT " WITH NEW DATA (Y/N)?"
420 Z$=INKEY$:IF Z$="" THEN 420
430 IF Z$="Y" OR Z$="y" THEN CLEAR:GOTO 40
440 IF Z$<>"N" AND Z$<>"n" THEN 400
450 END
